<template>
  <div>
    <footer class="footer">
      <div class="clearfix"></div>
<!--      <div class="icon-row">-->
<!--        <div class="footer-icon flex flex-a-c">-->
<!--          <h5 class="footer-icon-child">多</h5>-->
<!--          <span class="footer-icon-text">品類齐全，轻松购物</span>-->
<!--        </div>-->
<!--        <div class="footer-icon flex flex-a-c">-->
<!--          <h5 class="footer-icon-child footer-icon-child-2">快</h5>-->
<!--          <span class="footer-icon-text">多仓直發，极速配送</span>-->
<!--        </div>-->
<!--        <div class="footer-icon flex flex-a-c">-->
<!--          <h5 class="footer-icon-child footer-icon-child-3">好</h5>-->
<!--          <span class="footer-icon-text">正品行貨，精致服务</span>-->
<!--        </div>-->
<!--        <div class="footer-icon flex flex-a-c">-->
<!--          <h5 class="footer-icon-child footer-icon-child-4">省</h5>-->
<!--          <span class="footer-icon-text">天天低價，畅選無忧</span>-->
<!--        </div>-->
<!--      </div>-->
      <div class="service-intro">
        <div class="servece-type">
          <!--          <div v-for="(guide, index) in guideArr" :key="index" class="servece-type-info">
                      <ul>
                        <li v-for="(item, index) in guide" :key="index" @click="goArticle">{{ item }}</li>
                      </ul>
                    </div>-->

          <img :src="footImg" style="width: 1200px; height: 320px">
        </div>
        <div class="clearfix"></div>
        <div class="friend-link flex">
          <div class="friend-link-item">
            <ul>
              <li v-for="(link, index) in footerLink" :key="index" @click="goArticle(link.id)">
                <span :class="{'link-last-item': index === 4}" class="link-item">{{ getCEText(link) }}</span>
              </li>

            </ul>

          </div>

        </div>
        <div class="information footer-bottmom">
          <div class="icp">
            <li v-if="config.icpCard">
              <a :href='"https://tsm.miit.gov.cn/dxxzsp/xkz/xkzgl/resource/qiyesearch.jsp?num="+config.icpCard+"&type=xuke"'
                 target="_blank">
                {{ config.icpCard }}
              </a>
            </li>
            <li v-if="config.icpMessage" class="footer-bottmom">
              <a href="https://beian.miit.gov.cn/" target="_blank">
                {{ config.icpMessage }}
              </a>
            </li>
          </div>
          <!--<a class="flex " :href="config.company.href">
            <img class="zhizhao" src="@/assets/images/zhizhao.jpg" mode="" />{{config.company.name}}
          </a>-->
        </div>

        <div class="clearfix"></div>
        <div class="copyright">
          <p>Copyright © {{ config.title }}</p>
        </div>
      </div>
    </footer>
  </div>
</template>

<script>

import {handleFindFoot} from "@/api";
import {articleCateList, articleDetail,articleList} from "@/api/common";
import {findStoreByHost} from "@/api/common";
import i18n from "@/lang";

export default {
  i18n,
  name: "Footer",
  data() {
    return {
      footImg: '',
      config: {
        title: '',
        icpMessage: '',
        icpCard:''
      },
      storeId: '',
      activeName: '1347456734864367616', // 左侧激活项
      params: { // 請求參數
        pageNumber: 1,
        pageSize: 100,
        categoryId: '',
        sort: 'sort'
      },
      guideArr: [
        // 导航链接
        ["购物指南", "购物流程", "會員介紹", "生活旅行", "常见问題"],
        ["配送方式", "上門自提", "配送查询", "收取標准", "物流规则"],
        ["支付方式", "在线支付", "公司轉账", "余额支付", "積分支付"],
        ["售後服务", "售後政策", "退款说明", "返修/退貨", "取消訂單"],
      ],
      moreLink: [
        {name: "關於我們", type: 'about'},
        {name: "送貨資料", type: "goods"},
        {name: "常見問題", type: "familiar"},
        {name: "條款細則", type: "detailed"},
        {name: "私隱政策", type: "privacy"}], // 更多链接

      footerLink: [],
      year: new Date().getFullYear(), // 当前年份
    };
  },
  beforeCreate() {
    let _this = this;
   findStoreByHost(window.location.hostname).then(res => {
     window.localStorage.setItem("storeId", res.result);
     _this.config=require('@/config/right'+res.result+'.js');
     this.handleFood();
    })

    // handleFindFoot(this.storeId).then(res => {
    //   if (res.result) {
    //     this.footImg = res.result;
    //   }
    // })
    // 如果需要根据storeId加载配置，这里也可以进行
    // if (this.storeId) {
    //   this.config = require('@/config/right' + this.storeId + '.js');
    // }
  },
   created() {
    this.getFooterList();
  },
  methods: {

    handleFood(){
      handleFindFoot(this.storeId).then(res => {
        if (res.result) {
          this.footImg = res.result;
        }
      })
    },
    getFooterList(){
      // this.params.categoryId = id
      articleList(this.params).then(res => {
        if (res.success) {
          this.footerLink = res.result.records
          console.log(res)
        }
      })
    },
    getCEText(obj, filed) {
      if (typeof obj !== 'object') {
        return '';
      }
      if (this.$i18n.locale=== 'en') {
        return obj.enarticleCategoryName;
      }
      return obj.articleCategoryName;
    },
    goArticle(id) {
      // 跳转文章页
      // let routeUrl = this.$router.resolve({
      //   path: "/myOtherContent/"+id,
      // });
      // window.open(routeUrl.href, "_blank");
      // 跳转文章页
      this.$router.push({ path: `/myOtherContent/${id}` });
    },
  },
  // mounted() {
  //   handleFindFoot().then(res => {
  //     if (res.result) {
  //       this.footImg = res.result;
  //     }
  //   })
  // }
};
</script>

<style lang="scss" scoped>
/*****************************底 部 开 始*****************************/
.footer {
  width: 100%;
  height: 370px;
  background: #FFFFFF;
}

.icon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 1056px;
  height: 71px;
  margin: 0 auto;
}

.footer-icon {
  float: left;
}

.footer-icon-child {
  overflow: hidden;
  width: 36.4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18.2px;
  font-weight: normal;
  color: #333;
  height: 36.4px;
  border: 1.4px solid #CECECE;
  border-radius: 50%;
}

.icp {
  margin-right: 30px !important;

  > * {
    margin: 0 4px;
  }

  flex-direction: column;
}

.flex {
  display: flex;
  align-items: center;

  > img {
    margin-right: 4px;
  }
}

.footer-icon-text {
  margin-left: 11px;
  font-size: 16px;

  font-weight: normal;

  text-align: center;
}

.service-intro {
  width: 100%;
  border-top: 1px solid $border_color;
}

.servece-type {
  width: 1200px;
  height: 320px;
  margin: 22px auto 10px auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;

}

.servece-type-info {

}

.servece-type-info ul {
  list-style: none;
}

.servece-type-info li {
  font-size: 12px;
  cursor: pointer;
  font-weight: normal;
  line-height: 15px;
  text-align: center;
  margin-bottom: 13px;
  color: #333;
}

.servece-type-info li:first-child {
  font-size: 14.82px;
  font-weight: normal;
  line-height: 18px;

  letter-spacing: 0px;
  margin-bottom: 17px;
  color: #333333;
}

.friend-link {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 908px;
  padding: 10px 0;
  margin: 0px auto;
  border-top: 1px solid $border_color;
}

.information {
  margin-top: 23px;
  margin-bottom: 21px;
  display: flex;
  justify-content: center;

}

a {
  color: #3457FF;
}

.zhizhao {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.friend-link-item ul {
  list-style: none;
}

.friend-link-item li {
  padding: 5px 0px;
  float: left;
  margin-right: 59px;
  font-weight: normal;
  line-height: 13px;
  color: #333333;
}


.link-item {
  padding: 0px 8px;
  cursor: pointer;

}

.link-last-item {
  border: none;
}

.copyright {
  width: 100%;
  cursor: pointer;
  text-align: center;
  height: 25px;
  opacity: 1;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: normal;
  line-height: 13px;

  letter-spacing: 0px;

  color: #959595;
}

.footer-icon-text {
  @include title_color($light_title_color);
}

.copyright,
.friend-link,
.servece-type-info {
  @include sub_color($light_sub_color);
}

/*****************************底 部 结 束*****************************/
</style>
